#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
using namespace std;
vector<int> v;

int main() {
	int n; cin >> n;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		v.push_back(x);
	}

	for (int i = 0; i < v.size(); i++) cout << v[i] << " ";
	
	cout << endl;

	reverse(v.begin(), v.end());

	for (int e : v) cout << e << " ";
	return 0;
}	